package com.szd.qiongyou20.community.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.szd.qiongyou20.R;

import java.util.List;

/**
 * Created by SZD on 2016/12/29.
 */

public class GridView_Adapter extends BaseAdapter {

    private Context mContext;
    private List<String> mList;

    public GridView_Adapter(Context context, List<String> list) {
        mContext = context;
        mList = list;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_gridview_imageview, null);
        ImageView imageView = (ImageView) view.findViewById(R.id.imageView_gridView_show);
        String s = mList.get(position);
        Glide.with(mContext).load(s).into(imageView);
        return view;
    }
}
